import 'package:flutter/material.dart';
import 'package:myapp/routes_list.dart';
import 'package:myapp/store/settings_model.dart';
import 'package:myapp/store/user_model.dart';
import 'package:provider/provider.dart';

void main() {
  // runApp(const MyApp());
  runApp(MultiProvider(
    providers: [
      ChangeNotifierProvider<UserModel>(create: (context) => UserModel()),
      ChangeNotifierProvider<SettingsModel>(
          create: (context) => SettingsModel()),
      // 添加更多的Provider
    ],
    child: const MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        // routes: <String, WidgetBuilder>{
        //   "/Demo1": (BuildContext context) => Demo1(),
        //   "/Chat": (BuildContext context) => Chat()
        // },
        theme: ThemeData(
            splashColor: Colors.transparent,
            highlightColor: Colors.transparent,
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
            useMaterial3: true,
            primaryColor: Colors.red),
        initialRoute: '/', //配置默认访问路径
        routes: routes,
        onGenerateRoute: onGenerateRoute, //必须加上这一行，固定写法
        navigatorObservers: [MyRouteObserver()]);
  }
}
